package com.lyfx.ly.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lyfx.ly.entity.StudyRouteActivitiyEntity;
import com.lyfx.ly.service.StudyRouteActivitiyService;
import com.lyfx.common.utils.PageUtils;
import com.lyfx.common.utils.R;



/**
 * 
 *
 * @author lsy
 * @email lsy@gmail.com
 * @date 2020-07-18 11:13:41
 */
@RestController
@RequestMapping("ly/studyrouteactivitiy")
public class StudyRouteActivitiyController {
    @Autowired
    private StudyRouteActivitiyService studyRouteActivitiyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
   // @RequiresPermissions("ly:studyrouteactivitiy:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = studyRouteActivitiyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
   // @RequiresPermissions("ly:studyrouteactivitiy:info")
    public R info(@PathVariable("id") Long id){
		StudyRouteActivitiyEntity studyRouteActivitiy = studyRouteActivitiyService.getById(id);

        return R.ok().put("studyRouteActivitiy", studyRouteActivitiy);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("ly:studyrouteactivitiy:save")
    public R save(@RequestBody StudyRouteActivitiyEntity studyRouteActivitiy){
		studyRouteActivitiyService.save(studyRouteActivitiy);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("ly:studyrouteactivitiy:update")
    public R update(@RequestBody StudyRouteActivitiyEntity studyRouteActivitiy){
		studyRouteActivitiyService.updateById(studyRouteActivitiy);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("ly:studyrouteactivitiy:delete")
    public R delete(@RequestBody Long[] ids){
		studyRouteActivitiyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
